<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Tin_tuc extends CI_Controller {
    public function __construct() {
        parent::__construct();
        $this->load->library("MyMenu");
        $menu = new MyMenu;
        $this->load->model('News_model');
        $this->data['menu'] = $menu->show_menu();
        $this->data['title'] = "My Controller";
    }
    
    /**
     * Action:
     * Purpose:
     * Arguments:
     * Date:
     * Author:
     */
    public function index() {
        $this->data['news'] = $this->News_model->get_news();
        $this->data['container'] = $this->load->view('frontend/container/tin-tuc', $this->data, true);
        $this->load->view("frontend/layout", $this->data);
    }
    
    public function xem($id="0") {
        if ($id != 0) {
            $this->data['news'] = $this->News_model->get_news_by_id($id);
            $this->data['container'] = $this->load->view('frontend/container/tin-tuc-xem', $this->data, true);
        }
        $this->load->view("frontend/layout", $this->data);
    }
}
?>
